/**
 * Copyright 2005 The Apache Software Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.edi.controller;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.edi.Constant;
import com.edi.Kola;

public class InitController extends HttpServlet {

	private static final Log log = LogFactory.getLog(InitController.class);

	private static final long serialVersionUID = -7187361069577241735L;

	public void init() throws ServletException {
		log.info("Begin to start ediserver");
		String path = getServletContext().getRealPath("/");
		System.setProperty(Constant.EDIPATH, path);
		log.debug("Current servlet path : " + path);
		//		EDIServer ediServer = EDIServer.getEDIServerInstance(); 
		//		if (StringUtils.equals(EDIServer.ediServerType,Constant.SERVER_GRID_MODE)){
		//			GridServer gridServer= (GridServer)ediServer;
		//			gridServer.registToMainServer();
		//		}  
		//		Properties serverprops=EDIServer.getEDIServerInstance().getConfigure().getConfigPropertys();
		//		Object obj=serverprops.getProperty("inited");
		//		if(obj!=null&&!"".equals(obj)&&"true".equals(obj)){
		//			EdiCache.getInstance();
		//		}  
		

		try {
			Kola.init();
		} catch (Exception e) {
			log.error(e.getMessage());
		}
	}

}
